db = require '../utils/db'

module.exports = 
	'get /main/activity' : (req, res)->
		sql = "select * from activity where status > 0 "
		db.runSql sql , (err, result)->
			res.send result


	'get /main/activity/:id' : (req, res)->
		sql = "select * from activity where id = ?"
		db.queryOne sql, [req.params.id], (err, result)->
			res.send result

	'post /main/activity/:id/sign': (req, res)->
		sql = "insert into activity_sign set ?"
		db.runSql sql, [req.body], (err, result)->
			res.send success: not err?